import { createBrowserRouter } from 'react-router-dom'

import Login from '@/pages/Login'
import Layout from '@/pages/Layout'
import AuthRoute from '@/components/AuthRoute'
import ApiCenter from '@/pages/ApiCenter/index'
import PortalList from '@/pages/ServerPortal/list/index'
import PortalSubscribe from '@/pages/ServerPortal/subscribe/index'
import ControlSlo from '@/pages/ControlCenter/Slo/index'
import ControlRule from '@/pages/ControlCenter/Rule/index'
import ControlAnt from '@/pages/ControlCenter/Ant/index'
import ComponentAntd from '@/pages/Component/Antd/index'
import ComponentHeadless from '@/pages/Component/Headless/index'
import ComponentRadix from '@/pages/Component/Radix/index'
import SsrData from '@/pages/Ssr/Data/index'

const router = createBrowserRouter([
  {
    path: '/',
    element: <AuthRoute><Layout /></AuthRoute>,
    children: [
      {
        index: true,
        element: <ApiCenter />,
      },
      {
        path: 'portal/list',
        element: <PortalList />,
      },
      {
        path: 'portal/subscribe',
        element: <PortalSubscribe />,
      },
      {
        path: 'control/slo',
        element: <ControlSlo />,
      },
      {
        path: 'control/rule',
        element: <ControlRule />,
      },
      {
        path: 'control/ant',
        element: <ControlAnt />,
      },
      {
        path: 'component/antd',
        element: <ComponentAntd />,
      },
      {
        path: 'component/headless',
        element: <ComponentHeadless />,
      },
      {
        path: 'component/radix',
        element: <ComponentRadix />,
      },
      {
        path: 'ssr/data',
        element: <SsrData />,
      },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
])

export default router